output = open("output.txt", "w", encoding = "utf-8") #保存文件到本地
content = """
#编码
a = "圣诞节快乐"
a.encode("utf-8")

b'\xe5\x9c\xa3\xe8\xaf\x9e\xe8\x8a\x82\xe5\xbf\xab\xe4\xb9\x90'

#解码
b = b'\xe5\x9c\xa3\xe8\xaf\x9e\xe8\x8a\x82\xe5\xbf\xab\xe4\xb9\x90'
b
b'\xe5\x9c\xa3\xe8\xaf\x9e\xe8\x8a\x82\xe5\xbf\xab\xe4\xb9\x90'
b.decode("utf")
'圣诞节快乐'

#CRUD
#create
a = "圣"
a = a + "诞" + "节"
a
'圣诞节'

#Retrieve
a = ("Merry Christmas")
a[1]
'e'
a.find("C")
6

#UPDATE
a = ("Marry Christmas") #replace(替换)
a.replace("Ma", "Me")
'Merry Christmas'

a = "b, c, d" #split(分割)
a.split(", ")
['b', 'c', 'd']

b =  a.split(", ") #join (拼接)
b
['b', 'c', 'd']
", ".join(b)
'b, c, d'

#DELETE(删除)

a = "          hello         "  #strip
a
'          hello         '
a.strip()
'hello'

#格式化输出

a = "1"
b = "2"

print("加油: {}, {}".format(a, b)) # #按传入参数默认顺序

print("加油: {0}, {1}, {0}, {1}".format(a, b)) # 按指定参数索引

print("加油: {a}, {b}, {a}, {b}".format(a = "1", b = "2")) # 按关键词参数

print(f"加油: {a}, {b}") #按变量
"""
output.write(content) #写入文件
output.close # 关闭文件句柄